package com.nanyang.tms.service.weight.impl.flow;

import com.nanyang.common.core.domain.ApiRequest;
import com.nanyang.common.core.flow.context.TransHandlerContext;
import com.nanyang.common.core.flow.convert.TransConvert;
import com.nanyang.common.tool.utils.convert.BeanUtils;
import com.nanyang.tms.api.dto.request.forecast.ForecastInfoAddRequest;
import com.nanyang.tms.api.dto.request.waybill.CalWeightRequest;
import com.nanyang.tms.domain.forecast.context.CalculateWeightVolumeContext;
import com.nanyang.tms.domain.forecast.context.ForecastAddContext;
import com.nanyang.tms.domain.forecast.context.saveforecast.SaveForecastDeclareContext;
import com.nanyang.tms.domain.weight.context.WeightContext;

public class CalWeightConvert implements TransConvert{

	@Override
	public TransHandlerContext convertRequest2Ctx(ApiRequest req, TransHandlerContext context) {
		CalWeightRequest calWeightRequest=(CalWeightRequest)req;
		WeightContext weightContext=(WeightContext) context;
		//计算计费重所需参数
		BeanUtils.copyProperties(calWeightRequest, weightContext.getCalculateWeightContext());
		weightContext.getCalculateWeightContext().setCityCode(calWeightRequest.getProvinceCode());
		BeanUtils.copyListProperties(calWeightRequest.getVolumes(), weightContext.getCalculateWeightContext().getCalculateWeightVolumeContexts(), CalculateWeightVolumeContext.class);
		return weightContext;
	}

}
